<?

function construct_menu_item($level, $name, $item, $tabs = "\t\t") {
	if (is_array($item)) {
		echo "$tabs<li>\n";
		echo "$tabs\t<a".($level ? ' class="ys-next"' : '').">$name</a>\n";
		echo "$tabs\t<ul>\n";
		foreach ($item as $n => $i)
			construct_menu_item($level + 1, $n, $i, "\t\t$tabs");
		echo "$tabs\t</ul>\n";
		echo "$tabs</li>\n";
	} else {
		echo "$tabs<li><a href=\"<?= bf::url('$item') ?>\">$name</a></li>\n";
	}
}

?>
<div class="container_12">
	<div class="grid_12 menu-container">
		<ul class="ys-menu ys-menu-noscript">
<?
		foreach ($this->app->menu as $name => $item) {
			construct_menu_item(0, $name, $item);
		}
?>
		<li class="clear"></li>
		</ul>
	</div>
	<div class="clear"></div>
</div>